package net.aiform.account.action;

import javax.servlet.http.HttpServletRequest;

import net.aiform.account.pojo.Person;
import net.aiform.bean.Constant;

import org.apache.log4j.Logger;
import org.apache.struts2.interceptor.ServletRequestAware;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.Preparable;

public class LogoutAction implements Preparable, ServletRequestAware {
	private Logger log = Logger.getLogger(this.getClass());
	private HttpServletRequest req;
	private Person person;

	public String execute() {
		person = (Person) this.req.getSession().getAttribute(Constant.LOGINUSER);
		log.info("logout:" + person.toString());
		this.req.getSession().invalidate();
		return Action.SUCCESS;
	}

	@Override
	public void setServletRequest(HttpServletRequest request) {
		this.req = request;
	}

	@Override
	public void prepare() throws Exception {

	}

}
